package cn.com.sise.controller;

import cn.com.sise.dao.UserDao;
import cn.com.sise.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
public class UserController
{

@Resource
private UserDao userDao;

//用来接收来自登录页面的数据
@RequestMapping("/login")
public String login(User user, HttpSession session)
{
User user1=userDao.login(user);
if(user1!=null)
{
session.setAttribute("user",user1);
return "redirect:index.jsp";
//!在springmvc-config.xml的设置配置视图解析器后跳转有问题
//return "redirect:findAllMajors";
}
else{return "redirect:login.html";}

};//


};//class UserController
